<template>
  <div id="app">
    <div id="Chart1" style="width: 600px;height:400px;"></div>
  </div>
</template>

<script>``
export default {
  name: "app",
  methods: {
    drawChart() {
      // 基于准备好的dom，初始化echarts实例【这里存在一个问题，请看到最后】
      let Chart1 = this.$echarts.init(document.getElementById("Chart1"));
      // 指定图表的配置项和数据
      let option = {
        title: {
          text: "商品"
        },
        tooltip: {},
        legend: {
          data: ["销量"]
        },
        xAxis: {
          data: ["1月", "2月", "3月", "4月", "5月", "6月","7月","8月","9月","10月","11月","12月"]
        },
        yAxis: {},
        series: [
          {
            name: "销量",
            type: "bar",
            data: [1100, 888, 340, 980, 1250, 500, 690, 744, 863, 905, 1102, 1003],
          }
        ]
      };
      // 使用刚指定的配置项和数据显示图表。
      Chart1.setOption(option);
    }
  },
  mounted() {
    this.drawChart();
  }
};
</script>

<style>

</style>